package dispatcher.gui;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

/**
 * This class listens for a the window to close before enacting the termination protocol for the GUI
 * @author Caleb
 *
 */
public class GroupDispatcherWindowListener extends WindowAdapter {

	private GroupDispatcherView view;
	
	/**
	 * The main constructor
	 * @param view The view that holds the termination protocol of the GUI
	 */
	public GroupDispatcherWindowListener(GroupDispatcherView view){
		this.view = view;
	}
	
	/**
	 * This method is called when a window is closing and will enact the termination protocol of the
	 * GUI
	 */
	public void windowClosing(WindowEvent e){
		// Terminates handlers and logger
		this.view.terminate();
	}
		
}
